package cn.mill.core.modem;

import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;

import cn.mill.common.Context;
import cn.mill.common.data.Item;
import cn.mill.common.data.ItemArray;
import cn.mill.core.MillConfig;

public class MapSpell implements FieldSpell, ObjectSpell {
	
	public static final MapSpell INSTANCE = new MapSpell();
	
	@Override
	public <T> T builder(Type type, Item item) {
		
		return null;
	}
	
	@Override
	public <T> T builder(Type type, ItemArray itemArray) {
		Type t = null;
		if (type instanceof ParameterizedType) {
			t = ((ParameterizedType) type).getActualTypeArguments()[0];
		}
		ObjectSpell objectSpell = (ObjectSpell) MillConfig.getBuilder(t);
		return objectSpell.builder(t, itemArray);
	}
	
	@Override
	public ItemArray resolver(Context context, Type type, Object object) {
		
		return null;
	}
	
	@Override
	public Item resolver(Context context, String name, Type type, Object object) {
		
		return null;
	}
	
}
